import request from '@/utils/request'

export function query(data) {
  return request({
    url: `/md/workStations/query`,
    method: `post`,
    data
  })
}

/**
 * 保存
 * @param data
 */
export function save(data) {
  return request({
    url: `/md/workStations/save`,
    method: 'post',
    data
  })
}

/**
 * 删除
 * @param id
 */
export function remove(id) {
  return request({
    url: `/md/workStations/delete?bo=${id}`,
    method: 'delete'
  })
}

/**
 * 根据工艺路线获取工步配置
 * @param data.router
 * @param data.version
 * @param data.page.current
 * @param data.page.size
 */
export function queryConfigByRouter(data) {
  return request({
    url: `/md/routeStations/selectWsByRouterAndVersion?router=${data.router}&version=${data.version}&page=${data.page.current}&pageSize=${data.page.size}`,
    method: 'get'
  })
}

/**
 * 修改或者新增
 * @param data
 */
export function saveConfig(data) {
  return request({
    url: `/md/routeStations/saveConfig`,
    method: 'post',
    data
  })
}

export function getWorkStepConfigByRouter(data) {
  return request({
    url: `/md/routeStations/queryRouteStation?router=${data.router}&version=${data.version}&page=${data.page.current}&pageSize=${data.page.size}`,
    method: `get`
  })
}
